package com.skyolder.milkbee.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * createdAt  创建时间
 * userId  被禁止用户ID
 * leaguerId 被禁止成员ID
 * categoryId 被禁止板块ID
 * creator  使用禁止权的版主login
 * moderatorUserId 版主用户ID
 * moderatorLeaguerId 版主会员ID
 * forbidden 是否生效
 * invalidAt 取消禁止的时间
 */
/**
 * A Stranger.
 */
@Entity
@Table(name = "stranger")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Stranger implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "created_at")
    private ZonedDateTime createdAt;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "leaguer_id")
    private Long leaguerId;

    @Column(name = "category_id")
    private Long categoryId;

    @Column(name = "creator")
    private String creator;

    @Column(name = "moderator_user_id")
    private Long moderatorUserId;

    @Column(name = "moderator_leaguer_id")
    private Long moderatorLeaguerId;

    @Column(name = "invalid_user_id")
    private Long invalidUserId;

    @Column(name = "invalid_leaguer_id")
    private Long invalidLeaguerId;

    @Column(name = "forbidden")
    private Boolean forbidden;

    @Column(name = "invalid_at")
    private ZonedDateTime invalidAt;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public ZonedDateTime getCreatedAt() {
        return createdAt;
    }

    public Stranger createdAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
        return this;
    }

    public void setCreatedAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public Long getUserId() {
        return userId;
    }

    public Stranger userId(Long userId) {
        this.userId = userId;
        return this;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getLeaguerId() {
        return leaguerId;
    }

    public Stranger leaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
        return this;
    }

    public void setLeaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public Stranger categoryId(Long categoryId) {
        this.categoryId = categoryId;
        return this;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public String getCreator() {
        return creator;
    }

    public Stranger creator(String creator) {
        this.creator = creator;
        return this;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public Long getModeratorUserId() {
        return moderatorUserId;
    }

    public Stranger moderatorUserId(Long moderatorUserId) {
        this.moderatorUserId = moderatorUserId;
        return this;
    }

    public void setModeratorUserId(Long moderatorUserId) {
        this.moderatorUserId = moderatorUserId;
    }

    public Long getModeratorLeaguerId() {
        return moderatorLeaguerId;
    }

    public Stranger moderatorLeaguerId(Long moderatorLeaguerId) {
        this.moderatorLeaguerId = moderatorLeaguerId;
        return this;
    }

    public void setModeratorLeaguerId(Long moderatorLeaguerId) {
        this.moderatorLeaguerId = moderatorLeaguerId;
    }

    public Long getInvalidUserId() {
        return invalidUserId;
    }

    public Stranger invalidUserId(Long invalidUserId) {
        this.invalidUserId = invalidUserId;
        return this;
    }

    public void setInvalidUserId(Long invalidUserId) {
        this.invalidUserId = invalidUserId;
    }

    public Long getInvalidLeaguerId() {
        return invalidLeaguerId;
    }

    public Stranger invalidLeaguerId(Long invalidLeaguerId) {
        this.invalidLeaguerId = invalidLeaguerId;
        return this;
    }

    public void setInvalidLeaguerId(Long invalidLeaguerId) {
        this.invalidLeaguerId = invalidLeaguerId;
    }

    public Boolean isForbidden() {
        return forbidden;
    }

    public Stranger forbidden(Boolean forbidden) {
        this.forbidden = forbidden;
        return this;
    }

    public void setForbidden(Boolean forbidden) {
        this.forbidden = forbidden;
    }

    public ZonedDateTime getInvalidAt() {
        return invalidAt;
    }

    public Stranger invalidAt(ZonedDateTime invalidAt) {
        this.invalidAt = invalidAt;
        return this;
    }

    public void setInvalidAt(ZonedDateTime invalidAt) {
        this.invalidAt = invalidAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Stranger stranger = (Stranger) o;
        if (stranger.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, stranger.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Stranger{" +
            "id=" + id +
            ", createdAt='" + createdAt + "'" +
            ", userId='" + userId + "'" +
            ", leaguerId='" + leaguerId + "'" +
            ", categoryId='" + categoryId + "'" +
            ", creator='" + creator + "'" +
            ", moderatorUserId='" + moderatorUserId + "'" +
            ", moderatorLeaguerId='" + moderatorLeaguerId + "'" +
            ", invalidUserId='" + invalidUserId + "'" +
            ", invalidLeaguerId='" + invalidLeaguerId + "'" +
            ", forbidden='" + forbidden + "'" +
            ", invalidAt='" + invalidAt + "'" +
            '}';
    }
}
